package cn.com.pc.content.vo;

import cn.com.pc.content.domain.article.Article;
import cn.com.pc.content.domain.post.Post;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.beans.BeanUtils;

/**
 * 定制内容视图
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
public class PostViewVO extends Post {

    private String viewType;
    private String view;

    public static PostViewVO from(Post post, String viewType, String view) {
        PostViewVO postViewVO = new PostViewVO();
        BeanUtils.copyProperties(post, postViewVO);
        postViewVO.setViewType(viewType);
        postViewVO.setView(view);
        return postViewVO;
    }
}
